package com.levy.contronller.javase.designModel.bridge;

import com.levy.contronller.javase.designModel.bridge.color.Color;
import com.levy.contronller.javase.designModel.bridge.color.White;
import com.levy.contronller.javase.designModel.bridge.shape.Rectangle;
import com.levy.contronller.javase.designModel.bridge.shape.Shape;
import com.levy.contronller.javase.designModel.bridge.shape.Square;

/**
 * 桥接模式
 * 属于结构型模式
 * 把抽象化与实现化解耦，使得二者可以独立变化
 */
public class MainClass {

    public static void main(String[] args) {
        //白色
        Color white = new White();
        //正方形
        Shape square = new Square();
        //白色的正方形
        square.setColor(white);
        square.draw();

        //长方形
        Shape rectange = new Rectangle();
        rectange.setColor(white);
        rectange.draw();
    }
}
